home *** CD-ROM | disk | FTP | other *** search
/ SGI Cosmo Software 1997 May / SGI Cosmo Software 1997 May.iso / dist / dist6.3 / java_dev.idb / usr / java / include / sys_api.h.z / sys_api.h
Encoding:
C/C++ Source or Header  |  1997-05-24  |  6.4 KB  |  209 lines

  1. /*
  2.  * @(#)sys_api.h    1.62 97/02/17
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. /*
  24.  * System or Host dependent API.  This defines the "porting layer" for
  25.  * POSIX.1 compliant operating systems.
  26.  */
  27.  
  28. #ifndef _SYS_API_H_
  29. #define _SYS_API_H_
  30.  
  31. /*
  32.  * typedefs_md.h includes basic types for this platform;
  33.  * any macros for HPI functions have been moved to "sysmacros_md.h"
  34.  */
  35. #include "typedefs_md.h"
  36.  
  37. /*
  38.  * Miscellaneous system utility APIs that fall outside the POSIX.1
  39.  * spec.
  40.  *
  41.  * Until POSIX (P1003.1a) formerly P.4 is standard, we'll use our
  42.  * time struct definitions found in timeval.h.
  43.  */
  44. #include "timeval.h"
  45. long     sysGetMilliTicks(void);
  46. long    sysTime(long *);
  47. int64_t sysTimeMillis(void);
  48.  
  49. #include "time.h"
  50. struct tm * sysLocaltime(time_t *, struct tm*);
  51. struct tm * sysGmtime(time_t *, struct tm*);
  52. void        sysStrftime(char *, int, char *, struct tm *);
  53. time_t      sysMktime(struct tm*);
  54.  
  55. /*
  56.  * System API for general allocations
  57.  */
  58. void *    sysMalloc(size_t);
  59. void *    sysRealloc(void*, size_t);
  60. void    sysFree(void*);
  61. void *    sysCalloc(size_t, size_t);
  62. #ifdef PAGED_HEAPS
  63. void *  sysAllocBlock(size_t, void**);
  64. void    sysFreeBlock(void *);
  65. #endif /* PAGED_HEAPS */
  66.  
  67. /*
  68.  * System API for dynamic linking libraries into the interpreter
  69.  */
  70. char *  sysInitializeLinker(void);
  71. int     sysAddDLSegment(char *);
  72. void    sysSaveLDPath(char *);
  73. long    sysDynamicLink(char *);
  74. void    sysBuildLibName(char *, int, char *, char *);
  75. int     sysBuildFunName(char *, int, void *, int);
  76. #if 1 /* To facilitate coding sysInvokeNative in mips assembly: ssuresh */
  77. long *
  78. sysInvokeNative(void *,void *,long *,int,char *,void *,unsigned char *);
  79. #else
  80. long *  sysInvokeNative(void *, void *, long *, char *, int, void *);
  81. #endif
  82.  
  83. /*
  84.  * System API for invoking the interpreter from native applications
  85.  */
  86. void    sysGetDefaultJavaVMInitArgs(void *);
  87. int     sysInitializeJavaVM(void *, void *);
  88. int     sysFinalizeJavaVM(void *);
  89. void    sysAttachThreadLock();
  90. void    sysAttachThreadUnlock();
  91.  
  92. /*
  93.  * System API for threads
  94.  */
  95. typedef struct  sys_thread sys_thread_t;
  96. typedef struct  sys_mon sys_mon_t;
  97. typedef void *  stackp_t;
  98.  
  99. int     sysThreadBootstrap(sys_thread_t **, void *);
  100. void     sysThreadInitializeSystemThreads(void);
  101. int     sysThreadCreate(long, uint_t flags, void *(*)(void *),
  102.             sys_thread_t **, void *);
  103. void    sysThreadExit(void);
  104. sys_thread_t * sysThreadSelf(void);
  105. void    sysThreadYield(void);
  106. int     sysThreadVMSuspend(sys_thread_t *, sys_thread_t *);
  107. void    sysThreadVMSuspendMe(void);
  108. int     sysThreadVMUnsuspend(sys_thread_t *);
  109. int    sysThreadSuspend(sys_thread_t *);
  110. int    sysThreadResume(sys_thread_t *);
  111. int    sysThreadSetPriority(sys_thread_t *, int);
  112. int    sysThreadGetPriority(sys_thread_t *, int *);
  113. void *  sysThreadStackPointer(sys_thread_t *); 
  114. stackp_t sysThreadStackBase(sys_thread_t *); 
  115. void    sysThreadSetStackBase(sys_thread_t *, stackp_t); 
  116. int    sysThreadSingle(void);
  117. void    sysThreadMulti(void);
  118. int     sysThreadEnumerateOver(int (*)(sys_thread_t *, void *), void *);
  119. void    sysThreadInit(sys_thread_t *, stackp_t);
  120. void *  sysThreadGetBackPtr(sys_thread_t *);
  121. int     sysThreadCheckStack(void);
  122. long    sysThreadStackLimit(void);
  123. int     sysInterruptsPending(void);
  124. void    sysThreadPostException(sys_thread_t *, void *);
  125. void    sysThreadDumpInfo(sys_thread_t *);
  126. void    sysThreadInterrupt(sys_thread_t *);
  127. int     sysThreadIsInterrupted(sys_thread_t *, long);
  128. int     sysThreadAlloc(sys_thread_t **, stackp_t, void *);
  129. int     sysThreadFree(sys_thread_t *);
  130.  
  131. /*
  132.  * System API for monitors
  133.  */
  134. int     sysMonitorSizeof(void);
  135. int     sysMonitorInit(sys_mon_t *);
  136. int     sysMonitorDestroy(sys_mon_t *);
  137. int     sysMonitorEnter(sys_mon_t *);
  138. bool_t  sysMonitorEntered(sys_mon_t *);
  139. int     sysMonitorExit(sys_mon_t *);
  140. int     sysMonitorExitLocked(sys_mon_t *);
  141. int     sysMonitorNotify(sys_mon_t *);
  142. int     sysMonitorNotifyAll(sys_mon_t *);
  143. int     sysMonitorWait(sys_mon_t *, int, bool_t);
  144. void    sysMonitorDumpInfo(sys_mon_t *);
  145.  
  146. #define SYS_OK            0
  147. #define SYS_ERR           -1
  148. #define SYS_INTRPT     -2    /* Operation was interrupted */
  149. #define SYS_TIMEOUT    -3    /* A timer ran out */
  150. #define SYS_NOMEM      -5    /* Ran out of memory */
  151. #define SYS_NORESOURCE -6    /* Ran out of some system resource */
  152.  
  153. /*
  154.  * Symbolic constant to be used when waiting indefinitly on a condition
  155.  * variable
  156.  */
  157. #define SYS_TIMEOUT_INFINITY -1
  158.  
  159. /*
  160.  * System API for raw memory allocation
  161.  */
  162. void *  sysMapMem(long, long *);
  163. void *  sysUnmapMem(void *, long, long *);
  164. void *  sysCommitMem(void *, long, long *);
  165. void *  sysUncommitMem(void *, long, long *);
  166.  
  167. /*
  168.  * System API for termination
  169.  */
  170. void    sysExit(int);
  171. int    sysAtexit(void (*func)(void));
  172. void    sysAbort(void);
  173.  
  174. /*
  175.  * System API for files
  176.  */
  177. extern int sysIsAbsolute(const char* path);
  178. extern int sysAccess(const char* pFile, int perm);
  179.  
  180. extern int sysStat(const char *path, struct stat *sbuf);
  181. extern int sysFStat(int fd, struct stat * sbuf);
  182.  
  183. extern int sysOpen(const char *name, int openMode, int filePerm);
  184. extern int sysClose(int fd);
  185.  
  186. extern long sysSeek(int fd, long offset, int whence);
  187. extern int sysAvailable(int fd, long* bytes);
  188. extern size_t sysRead(int fd, void *buf, unsigned int nBytes);
  189. extern size_t sysWrite(int fd, const void *buf, unsigned int nBytes);
  190.  
  191. extern int sysRename(const char* srcName, const char* dstName);
  192. extern int sysUnlink(const char* file);
  193.  
  194. extern int sysMkdir(const char* path, int mode);
  195. extern int sysRmdir(const char* path);
  196. extern int sysCanonicalPath(char *path, char *result, int result_len);
  197.  
  198. #include "io_md.h"
  199. extern DIR* sysOpenDir(const char* path);
  200. extern int sysCloseDir(DIR* dp);
  201. extern struct dirent* sysReadDir(DIR* dp);
  202.  
  203. /*
  204.  * Include platform specific macros to override these
  205.  */
  206. #include "sysmacros_md.h"
  207.  
  208. #endif /* !_SYS_API_H_ */
  209.